<?php

namespace App\Admin\Models;

use Illuminate\Database\Eloquent\Model;

class Permission extends Model
{
    protected $table = 'admin_permissions';
    protected $guarded = [];


    /*
     * 获取所有权限
     * @author turtle
     * create_time 2017-01-02
     */

    public static function getAllPermissions() {
        return self::get()->groupBy('table_name');
    }

    /* 获取权限信息
     * @author turtle
     * create_time 2017-01-03
     */

    public static function getPermissionInfo($permissions) {
        return self::whereIn('id', $permissions)->get()->groupBy('table_name');
    }

    /*
     * 获取权限标志
     * @author turtle
     * create_time 2017-01-15
     */

    public static function getPermissionSign($permissions) {
        return self::whereIn('id', $permissions)->select('sign')->get();
    }
}
